package flc.ast.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.stark.file.transfer.base.BaseReceiveScanQrActivity1;

import flc.ast.R;
import flc.ast.dialog.ReceiverProgressDialog;
import stark.common.basic.utils.StatusBarUtils;

public class FileScanQrActivity extends BaseReceiveScanQrActivity1 {


    @Override
    public int getLayoutId() {
        return R.layout.activity_file_scan_qr;
    }

    @Override
    public void initUI() {
        //注意：这里必须要调用父类的initUI方法，否则会出错
        super.initUI();

        StatusBarUtils.with(this).init();
        StatusBarUtils.setSystemStatusTextColor(false, this);
        int id = getViewfinderViewId();
        mViewfinderView = findViewById(id);
        if (mViewfinderView != null) {
            mViewfinderView.setLabelText("");
        }

        ImageView ivBack = findViewById(R.id.ivFileScanBack);
        ivBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });


    }

    @Override
    protected void goFileReceiveActivity(String serverIp) {
        ShowReceiverDialog(serverIp);
    }

    private void ShowReceiverDialog(String serverIp) {
        ReceiverProgressDialog dialog = new ReceiverProgressDialog(this);
        dialog.hasSuccess = false;
        dialog.serverIp = serverIp;
        dialog.setListener(new ReceiverProgressDialog.Ilistener() {
            @Override
            public void clickConfirm() {
                onBackPressed();
            }
        });
        dialog.show();
    }
}